<include file="Public/min-header"/>
<div class="wrapper">
    <!-- Content Header (Page header) -->
    <include file="Public/breadcrumb"/>
    <section class="content">
        <!-- Main content -->
        <!--<div class="container-fluid">-->
        <div class="row">
            <div class="col-sm-12">
                <div class="panel panel-default">
                    <div class="pull-right">
                        <a href="javascript:history.go(-1)" data-toggle="tooltip" title="" class="btn btn-default" data-original-title="返回"><i class="fa fa-reply"></i></a>
                    </div>
                    <div class="panel-heading">
                        <h3 class="panel-title"><i class="fa fa-list"></i> 添加人员</h3>
                    </div>
                    <div class="panel-body">
                        <form action="" method="post" onsubmit="return checkUserUpdate(this);" enctype="multipart/form-data" >
                            <input type="hidden" name="id" value="{$info.id}"/>
                            <table class="table table-bordered">
                                <tbody>
                                <tr>
                                    <td class="col-sm-2">姓名:</td>
                                    <td ><input type="text" class="form-control" name="name" value="{$info.name}"></td>
                                    <td></td>
                                </tr>
                                <tr>
                                    <td class="col-sm-2">类别:</td>
                                    <td >
                                        <select name="c_id" id="c_id" class="form-control">
                                            <option value="0">--选择类别--</option>
                                            <option value="1" <if condition="$info[c_id] eq 1">selected</if>>管理员</option>
                                            <option value="2" <if condition="$info[c_id] eq 2">selected</if>>财务</option>
                                            <option value="3" <if condition="$info[c_id] eq 3">selected</if>>主管</option>
                                        </select>
                                        <!--<input type="text" class="form-control" name="name" value="{$sales.name}">-->
                                    </td>
                                    <td></td>
                                </tr>

                                <tr>
                                    <td>手机:</td>
                                    <td>
                                        <input type="text" class="form-control" name="mobile" value="{$info.mobile}">
                                    </td>
                                </tr>
                                <tr>
                                    <td>邮件地址:</td>
                                    <td><input type="text" class="form-control" name="email" value="{$info.email}"></td>
                                </tr>
                                <tr>
                                    <td></td>
                                    <td>
                                        <button type="submit" class="btn btn-info">
                                            <i class="ace-icon fa fa-check bigger-110"></i> 保存
                                        </button>
                                        <input type="reset" class="btn btn-default pull-right" value="重置">
                                    </td>
                                </tr>
                                </tbody>
                            </table>
                        </form>

                    </div>
                </div>
            </div>
        </div>    <!-- /.content -->
    </section>
</div>
<script>


    // 上传商品图片成功回调函数
    function call_back1(fileurl_tmp){
        $("#head_img").val(fileurl_tmp);
        $("#head_img1").attr('href', fileurl_tmp);
    }


    function checkUserUpdate(){
        var name = $('input[name="name"]').val();
        var email = $('input[name="email"]').val();
        var mobile = $('input[name="mobile"]').val();
        var error ='';

        if(name == ''  ){
            error += "姓名不能为空\n";
        }
        if(mobile ==''){
            error += "手机不能为空\n";
        }
        if(email == ''  ){
            error += "email不能为空\n";
        }

        if(!checkEmail(email) && email != ''){
            error += "邮箱地址有误\n";
        }
        if(!checkMobile(mobile) && mobile != ''){
            error += "手机号码填写有误\n";
        }

        if(error){
            layer.alert(error, {icon: 2});  //alert(error);
            return false;
        }
        return true;

    }
</script>

</body>
</html>